package org.idea.qiyu.framework.rocketmq.order.producer.controller;

import org.apache.rocketmq.client.producer.SendResult;
import org.idea.qiyu.framework.rocketmq.annotation.QiyuProducer;
import org.idea.qiyu.framework.rocketmq.config.producer.MqProducerTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author linhao
 * @Date created in 11:21 上午 2021/7/2
 */
@RestController
@RequestMapping(value = "mq-send")
public class MqSendController {

    @QiyuProducer(topic = "qiyu-topic",tag = "qiyu")
    private MqProducerTemplate mqProducerTemplate;

    @GetMapping(value = "/send")
    public boolean sendMq(){
        for(int i=0;i<10000;i++){
            SendResult sendResult = mqProducerTemplate.send("idea-tag");
            System.out.println(sendResult.getSendStatus());
        }
        return true;
    }
}
